import request from '@/utils/request'

export default {
  // 列表
  query(data) {
    return request({
      url: `/v1/purchase/purchase-order/list`,
      method: 'post',
      data
    })
  },
  // 确认
  confirm(data) {
    return request({
      url: `/v1/purchase/purchase-order/confirm`,
      method: 'post',
      data
    })
  },
  // 驳回
  reject(data) {
    return request({
      url: `/v1/purchase/purchase-order/reject`,
      method: 'post',
      data
    })
  },
  // 暂停
  pause(data) {
    return request({
      url: `/v1/purchase/purchase-order/pause`,
      method: 'post',
      data
    })
  },
  // 统计
  total(params) {
    return request({
      url: `/v1/purchase/purchase-order/total`,
      method: 'get',
      params
    })
  },
  // 获取选中明细(生成采购单使用)
  detail(data) {
    return request({
      url: `/v1/purchase/purchase-order/get-detail`,
      method: 'post',
      data
    })
  },
  // 一键生成采购单
  processCreate(data) {
    return request({
      url: `/v1/purchase/purchase-process/process-create`,
      method: 'post',
      data,
      timeout: 180000,
    })
  },
  // 调整采购
  updatePurchase(data) {
    return request({
      url: `/v1/purchase/purchase-order/update-purchase-user`,
      method: 'post',
      data
    })
  },
  // 新增采购备注
  remark(data) {
    return request({
      url: `/v1/purchase/purchase-order/remark`,
      method: 'post',
      data
    })
  },
  // 查询采购备注历史
  historyRemark(data) {
    return request({
      url: `/v1/purchase/purchase-order/history-reason`,
      method: 'post',
      data
    })
  },
  // 继续下单
  continue(data) {
    return request({
      url: `/v1/purchase/purchase-order/continue-order`,
      method: 'post',
      data
    })
  },
}
